/*LICENSE_BEGIN
 * ******************************************************************
 * All original parts of SoccerScope2003 have copyright (2003) by
 * Team YowAI, represented by Mr. Shuhei Shiota
 * The Department of Creative Informatics
 * The Graduate School of Information Science and Technology
 * The University of Tokyo
 * 
 * Additional classes (except libraries in /lib) were developed by 
 * the Dainamite Robocup-Team of the DAI-Labor, TU-Berlin 
 * (www.dai-labor.de)
 * 
 * Extended/new classes/packages are:
 *   soccerscope.analyzer.LogfileAnalyzer
 *   soccerscope.daistatistic.*
 *   soccerscope.daistatistic.charts.*
 *   soccerscope.daistatistic.tools.*
 *   soccerscope.db.*
 *   soccerscope.dialog.*
 *   soccerscope.model.PlayerWorldModel
 *   soccerscope.model.SimplePlayer
 *   soccerscope.net.AgentConnector
 *   soccerscope.training.*
 *   soccerscope.training.conditions.*
 * ******************************************************************
LICENSE_END*/
package soccerscope.model;

import java.io.Serializable;

import robocup.component.tactics.AbstractState.STATES;
import robocup.component.worldobjects.Player;
import soccerscope.util.geom.Point2f;

/**
 * the simple player object a simple player has speed and position
 * 
 */
public class SimplePlayer implements Serializable {

    public SimplePlayer() {
    }

    /**
     * creates a new SimplePlayer and copy all data from specified player in the
     * new object.
     * 
     * @param player
     *            the player with the original data
     * @param incorrectCoodinates
     *            is the coordinate system not correct?
     */
    public SimplePlayer(Player player, boolean incorrectCoodinates) {
        this.copy(player, incorrectCoodinates);
    }

    /**
     * Copies data of a specified player to this object.
     * 
     * @param player
     *            the player with the original data
     * @param incorrectCoodinates
     *            is the coordinate system not correct?
     */
    public void copy(Player player, boolean incorrectCoodinates) {
        double correction = 1.0;
        if (incorrectCoodinates) {
            correction = -1.0;
        }
        this.isGoalie = player.isGoalie();
        this.positionX = player.getPosition().x * correction;
        this.positionY = player.getPosition().y * correction;
        this.speedX = player.getSpeed().x * correction;
        this.speedY = player.getSpeed().y * correction;
        this.positionIsReliable = player.isReliable();
        this.simpleBody = player.getBodyDir();
        this.lastState = player.getLastState();
        this.roleNumber = player.getRoleNumber();
    }

    private static final long serialVersionUID = 5112799571089893327L;

    public double positionX = -9999;

    public double positionY = -9999;

    public boolean positionIsReliable = true;

    public boolean isGoalie = false;

    public double simpleBody = 0;

    public double speedX = -9999;

    public double speedY = -9999;

    public int ballInterceptionTime = -1;

    public int stamina = 4000;

    public int playerType = 0;

    public STATES lastState = STATES.DUMMY_STATE;

    public int roleNumber = -1;

    public Point2f bestPos = null;
}
